$(function(){
	$JsApi_Share.init();
	setContentHeight();
	getInfo();
	scrollTitle(3000,50);
});
function setContentHeight(){
	var hei= $(window).height();
	$(".info").height(hei - 176);
	$(".winner-list").height(hei - 176);
	$(".j-winner-list").height(hei - 178);
}
function getInfo(){	
	var winnerListUl = $("#j-winner-list");
	$.ajax( {
		dataType : 'json',
		url :"http://www.gofull.com.cn/dwGameAwardList.do",
		data : {},
		type : 'POST',
		beforeSend : function() {
		},
		success : function(data) {
			if(data){
				var htmlStr = '';
                var list = data.lists;
                if(list.length > 0){
                	for(var i=0,len=list.length;i<len;i++){
                		htmlStr += '<li style="display: block;" class="clearfix ks-switchable-panel-internal209">';
                		htmlStr += '<div class="winner-list-item list-uname"><div class="winner-nick">';
                		htmlStr += list[i].username;
                		htmlStr += '</div></div>';
                		htmlStr += '<div class="winner-list-item list-prize"><div class="winner-nick">';
                		htmlStr += '获得' + list[i].remarks;
                		htmlStr += '</div></div></li>';
                	}
                	winnerListUl.append(htmlStr);
                }
			}
		},
		error : function() {
		}
	});
}
function changeUrl(url){
	location.href= url;
}
/*滚动名单*/
function scrollTitle(changeSpeed, scrollSpeed) {
	var con = document.getElementById("J_WinnerList");
	var list = document.getElementById("j-winner-list");
	list.innerHTML += list.innerHTML;
	var items = list.getElementsByTagName("li");
	var timer_1 = setInterval(_scrollTitle, changeSpeed);
	var heightAll = 0;
	for (var i = 0; i < items.length; i++) {
		heightAll += items[i].offsetHeight
	}
	var heightHalf = parseInt(heightAll / 2);
	con.onmouseover = function() {
		if (timer_1) {
			clearInterval(timer_1);
			timer_1 = null
		}
	};
	con.onmouseout = function() {
		if (timer_1) {
			clearInterval(timer_1);
			timer_1 = null
		}
		timer_1 = setInterval(_scrollTitle, changeSpeed)
	};

	function _scrollTitle() {
		var timer;
		var num = 30;
		timer = setInterval(scrollTop, scrollSpeed);

		function scrollTop() {
			if (con.scrollTop < heightHalf) {
				con.scrollTop += 3;
				num -= 3
			} else {
				con.scrollTop = 0
			}
			if (num <= 0) {
				clearInterval(timer)
			}
		}
	}
};
